//
//  HeightFor.m
//  UI_类似的朋友圈
//
//  Created by dllo on 15/8/19.
//  Copyright (c) 2015年 蓝鸥科技. All rights reserved.
//

#import "HeightFor.h"

@implementation HeightFor

+ (CGFloat)heightWithString:(NSString *)string Width:(CGFloat)width FontSize:(CGFloat)fontsize
{
  // 获取文本内容
    
    // 显示范围
    CGSize size = CGSizeMake(width, 10000);
    // 定制字体容器
    NSDictionary *dic = @{NSFontAttributeName:[UIFont systemFontOfSize:fontsize]};
    //字符串计算
    CGRect rect = [string boundingRectWithSize:size options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
    return rect.size.height;
}
@end
